3.1.21 \(\int \sqrt {a+b \cot ^2(x)} \tan (x) \, dx\) [21]

Optimal. Leaf size=60 \[ \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \]

[Out]

arctanh((a+b*cot(x)^2)^(1/2)/a^(1/2))*a^(1/2)-arctanh((a+b*cot(x)^2)^(1/2)/(a-b)^(1/2))*(a-b)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3751, 457, 85, 65, 214} \begin {gather*} \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sqrt[a + b*Cot[x]^2]*Tan[x],x]

[Out]

Sqrt[a]*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]] - Sqrt[a - b]*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 85

Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[(b*e - a*f)/(b*c
- a*d), Int[(e + f*x)^(p - 1)/(a + b*x), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[(e + f*x)^(p - 1)/(c + d*x
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && LtQ[0, p, 1]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps

\begin {align*} \int \sqrt {a+b \cot ^2(x)} \tan (x) \, dx &=-\text {Subst}\left (\int \frac {\sqrt {a+b x^2}}{x \left (1+x^2\right )} \, dx,x,\cot (x)\right )\\ &=-\left (\frac {1}{2} \text {Subst}\left (\int \frac {\sqrt {a+b x}}{x (1+x)} \, dx,x,\cot ^2(x)\right )\right )\\ &=-\left (\frac {1}{2} a \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\right )-\frac {1}{2} (-a+b) \text {Subst}\left (\int \frac {1}{(1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\\ &=-\frac {a \text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}-\frac {(-a+b) \text {Subst}\left (\int \frac {1}{1-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}\\ &=\sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.03, size = 60, normalized size = 1.00 \begin {gather*} \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sqrt[a + b*Cot[x]^2]*Tan[x],x]

[Out]

Sqrt[a]*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]] - Sqrt[a - b]*ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]]

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.83, size = 591, normalized size = 9.85

method result size
default \(\frac {\left (\EllipticF \left (\frac {\left (-1+\cos \left (x \right )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \left (x \right )}, \sqrt {\frac {8 a^{\frac {3}{2}} \sqrt {a -b}-4 \sqrt {a}\, \sqrt {a -b}\, b +8 a^{2}-8 a b +b^{2}}{b^{2}}}\right ) b -2 \EllipticPi \left (\frac {\left (-1+\cos \left (x \right )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \left (x \right )}, \frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) a +2 \EllipticPi \left (\frac {\left (-1+\cos \left (x \right )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \left (x \right )}, -\frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) a -2 \EllipticPi \left (\frac {\left (-1+\cos \left (x \right )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \left (x \right )}, -\frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) b \right ) \left (\sin ^{3}\left (x \right )\right ) \sqrt {-\frac {2 \left (\cos \left (x \right ) \sqrt {a}\, \sqrt {a -b}+a \cos \left (x \right )-b \cos \left (x \right )-\sqrt {a}\, \sqrt {a -b}-a \right )}{\left (\cos \left (x \right )+1\right ) b}}\, \sqrt {2}\, \sqrt {\frac {\cos \left (x \right ) \sqrt {a}\, \sqrt {a -b}-a \cos \left (x \right )+b \cos \left (x \right )-\sqrt {a}\, \sqrt {a -b}+a}{\left (\cos \left (x \right )+1\right ) b}}\, \sqrt {\frac {\left (\cos ^{2}\left (x \right )\right ) a -b \left (\cos ^{2}\left (x \right )\right )-a}{\cos ^{2}\left (x \right )-1}}\, \sqrt {4}}{2 \left (-1+\cos \left (x \right )\right ) \left (\left (\cos ^{2}\left (x \right )\right ) a -b \left (\cos ^{2}\left (x \right )\right )-a \right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\) \(591\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*cot(x)^2)^(1/2)*tan(x),x,method=_RETURNVERBOSE)

[Out]

1/2*(EllipticF((-1+cos(x))*((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2)/sin(x),((8*a^(3/2)*(a-b)^(1/2)-4*a^(1/2)*(a
-b)^(1/2)*b+8*a^2-8*a*b+b^2)/b^2)^(1/2))*b-2*EllipticPi((-1+cos(x))*((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2)/si
n(x),1/(2*a^(1/2)*(a-b)^(1/2)-2*a+b)*b,(-(2*a^(1/2)*(a-b)^(1/2)+2*a-b)/b)^(1/2)/((2*a^(1/2)*(a-b)^(1/2)-2*a+b)
/b)^(1/2))*a+2*EllipticPi((-1+cos(x))*((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2)/sin(x),-1/(2*a^(1/2)*(a-b)^(1/2)
-2*a+b)*b,(-(2*a^(1/2)*(a-b)^(1/2)+2*a-b)/b)^(1/2)/((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2))*a-2*EllipticPi((-1
+cos(x))*((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2)/sin(x),-1/(2*a^(1/2)*(a-b)^(1/2)-2*a+b)*b,(-(2*a^(1/2)*(a-b)^
(1/2)+2*a-b)/b)^(1/2)/((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2))*b)*sin(x)^3*(-2*(cos(x)*a^(1/2)*(a-b)^(1/2)+a*c
os(x)-b*cos(x)-a^(1/2)*(a-b)^(1/2)-a)/(cos(x)+1)/b)^(1/2)*2^(1/2)*((cos(x)*a^(1/2)*(a-b)^(1/2)-a*cos(x)+b*cos(
x)-a^(1/2)*(a-b)^(1/2)+a)/(cos(x)+1)/b)^(1/2)*((cos(x)^2*a-b*cos(x)^2-a)/(cos(x)^2-1))^(1/2)/(-1+cos(x))/(cos(
x)^2*a-b*cos(x)^2-a)*4^(1/2)/((2*a^(1/2)*(a-b)^(1/2)-2*a+b)/b)^(1/2)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(x)^2)^(1/2)*tan(x),x, algorithm="maxima")

[Out]

integrate(sqrt(b*cot(x)^2 + a)*tan(x), x)

________________________________________________________________________________________

Fricas [A]
time = 2.72, size = 351, normalized size = 5.85 \begin {gather*} \left [\frac {1}{2} \, \sqrt {a} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right ) + \frac {1}{2} \, \sqrt {a - b} \log \left (\frac {{\left (2 \, a - b\right )} \tan \left (x\right )^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2} + 1}\right ), -\sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a - b}\right ) + \frac {1}{2} \, \sqrt {a} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right ), -\sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a}\right ) + \frac {1}{2} \, \sqrt {a - b} \log \left (\frac {{\left (2 \, a - b\right )} \tan \left (x\right )^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2} + 1}\right ), -\sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a}\right ) - \sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a - b}\right )\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(x)^2)^(1/2)*tan(x),x, algorithm="fricas")

[Out]

[1/2*sqrt(a)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b) + 1/2*sqrt(a - b)*log(
((2*a - b)*tan(x)^2 - 2*sqrt(a - b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b)/(tan(x)^2 + 1)), -sqrt(-a +
b)*arctan(-sqrt(-a + b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/(a - b)) + 1/2*sqrt(a)*log(2*a*tan(x)^2 + 2*sqrt(a)*sq
rt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b), -sqrt(-a)*arctan(sqrt(-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/a) + 1/
2*sqrt(a - b)*log(((2*a - b)*tan(x)^2 - 2*sqrt(a - b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b)/(tan(x)^2
+ 1)), -sqrt(-a)*arctan(sqrt(-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/a) - sqrt(-a + b)*arctan(-sqrt(-a + b)*sqrt((
a*tan(x)^2 + b)/tan(x)^2)/(a - b))]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \sqrt {a + b \cot ^{2}{\left (x \right )}} \tan {\left (x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(x)**2)**(1/2)*tan(x),x)

[Out]

Integral(sqrt(a + b*cot(x)**2)*tan(x), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 187 vs. \(2 (48) = 96\).
time = 0.50, size = 187, normalized size = 3.12 \begin {gather*} \frac {1}{2} \, {\left (\frac {2 \, \sqrt {a - b} a \arctan \left (\frac {{\left (\sqrt {a - b} \sin \left (x\right ) - \sqrt {a \sin \left (x\right )^{2} - b \sin \left (x\right )^{2} + b}\right )}^{2} - 2 \, a + b}{2 \, \sqrt {-a^{2} + a b}}\right )}{\sqrt {-a^{2} + a b}} + \sqrt {a - b} \log \left ({\left (\sqrt {a - b} \sin \left (x\right ) - \sqrt {a \sin \left (x\right )^{2} - b \sin \left (x\right )^{2} + b}\right )}^{2}\right )\right )} \mathrm {sgn}\left (\sin \left (x\right )\right ) - \frac {{\left (2 \, \sqrt {a - b} a \arctan \left (-\frac {a - b}{\sqrt {-a^{2} + a b}}\right ) + \sqrt {-a^{2} + a b} \sqrt {a - b} \log \left (b\right )\right )} \mathrm {sgn}\left (\sin \left (x\right )\right )}{2 \, \sqrt {-a^{2} + a b}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(x)^2)^(1/2)*tan(x),x, algorithm="giac")

[Out]

1/2*(2*sqrt(a - b)*a*arctan(1/2*((sqrt(a - b)*sin(x) - sqrt(a*sin(x)^2 - b*sin(x)^2 + b))^2 - 2*a + b)/sqrt(-a
^2 + a*b))/sqrt(-a^2 + a*b) + sqrt(a - b)*log((sqrt(a - b)*sin(x) - sqrt(a*sin(x)^2 - b*sin(x)^2 + b))^2))*sgn
(sin(x)) - 1/2*(2*sqrt(a - b)*a*arctan(-(a - b)/sqrt(-a^2 + a*b)) + sqrt(-a^2 + a*b)*sqrt(a - b)*log(b))*sgn(s
in(x))/sqrt(-a^2 + a*b)

________________________________________________________________________________________

Mupad [B]
time = 0.48, size = 69, normalized size = 1.15 \begin {gather*} \mathrm {atanh}\left (\frac {2\,a\,b^3\,\sqrt {a-b}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{2\,a\,b^4-2\,a^2\,b^3}\right )\,\sqrt {a-b}+\sqrt {a}\,\mathrm {atanh}\left (\frac {\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{\sqrt {a}}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(x)*(a + b*cot(x)^2)^(1/2),x)

[Out]

atanh((2*a*b^3*(a - b)^(1/2)*(a + b/tan(x)^2)^(1/2))/(2*a*b^4 - 2*a^2*b^3))*(a - b)^(1/2) + a^(1/2)*atanh((a +
 b/tan(x)^2)^(1/2)/a^(1/2))

________________________________________________________________________________________